JgfNode   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 23
rs 10
c 0
b 0
f 0
wmc 3

2 Functions

Rating   Name   Duplication   Size   Complexity  
A constructor 0 5 1
A metadata 0 4 1
1
const { Guard } = require('./guard');
2
3
/**
4
 * A node object represents a node in a graph. In graph theory, nodes are also called points or vertices.
5
 */
6
class JgfNode {
7
8
    /**
9
     * Constructor
10
     * @param {string} id Primary key for the node, that is unique for the object type.
11
     * @param {string} label A text display for the node.
12
     * @param {object|null} metadata Metadata about the node.
13
     */
14
    constructor(id, label, metadata = null) {
15
        this.id = id;
16
        this.label = label;
17
        this.metadata = metadata;
18
    }
19
20
    set metadata(metadata) {
21
        Guard.assertValidMetadataOrNull(metadata);
22
        this._metadata = metadata;
23
    }
24
25
    get metadata() {
26
        return this._metadata;
27
    }
28
}
29
30
module.exports = {
31
    JgfNode,
32
};